package com.jacoco.incremental.utils;

public class ViewInfo {

    public static void info(String... message) {
        message[0] = "\033[34;4minfo\033[0m - " + message[0];
        sendMessage(message);
    }

    public static void error(String... message) {
        message[0] = "\033[31;4m error\033[0m - " + message[0];
        String error = sendMessage(message);
        throw new RuntimeException(error);
    }

    public static void help() {
        StringBuilder builder = new StringBuilder("Script Options:");
        builder.append("\n\t\t-f 配置文件");
        sendMessage(new String[]{builder.toString()});
    }

    private static String sendMessage(String[] message) {
        StringBuilder builder = new StringBuilder(message[0]);
        for (int i = 1; i < message.length; i++) {
            builder.replace(builder.indexOf("{"), builder.indexOf("}") + 1, message[i]);
        }
        System.out.println(builder.toString());
        return builder.toString();
    }


}
